package com.flats.webview;

import com.flats.model.entity.Owner;
import com.flats.service.transactional.TransactionalOwnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class OwnerDetailController {
    @Autowired
    TransactionalOwnerService ownerService;

    @RequestMapping(value = "/owner.detail")
    public String viewOwnerDetails(Model model,@RequestParam(value = "ownerId") String ownerId) {
        System.out.println("Open owner details");
        System.out.println("ownerId = " + ownerId);
        Owner owner = ownerService.get(Long.valueOf(ownerId));
        model.addAttribute("owner",owner);
        return "ownerDetails";
    }
}
